#ifndef SERVERSOCKET_H
#define SERVERSOCKET_H

#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <pthread.h>
#include <cstring>

class ServerSocket
{
public:
    ServerSocket();
    void listenConnection(int n = 50);
    int acceptConnection();
private:
    void errorClose();

    int _connectionSocket;
    struct sockaddr_in serverAddress, clientAddress;
    socklen_t _clilen;
    int _newConnectionSocket;
};

#endif // SERVERSOCKET_H
